1 Public Class FrmCatList
2
3
4 Private Sub FrmCatList_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
5 MDIDISABLED()
6 End Sub
7
8 Private Sub FrmCatList_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
9 Audit_Trail(xUser_ID, TimeOfDay, "View Product Listing")
10 End Sub
11
12 Private Sub RBCat_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RBCat.CheckedChanged
13 If RBCat.Checked Then
14 With MDIMain
15 .cmdEdit.Enabled = False
16 .cmdPrint.Enabled = False
17 .cmdSearch.Enabled = True
18 ' .ToolStripEdit.Enabled = False
19 ' .ToolStripPrint.Enabled = False
20 End With
21 grpcatitem.Visible = False
22 'GroupBox1.Visible = True
23 FillListView(ExecuteSQLQuery("SELECT Catg_ID as 'Category ID', Catg_Name as 'Category Name', Catg_Description as 'Category Description' FROM tbl_Category_File"), lstCat, 0)
24 End If
25 End Sub
26
27 Private Sub RBALL_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RBALL.CheckedChanged
28 If RBALL.Checked Then
29 'MDIREFRESH()
30 With MDIMain
31 ' .ToolStripDelete.Enabled = False
32 .cmdDelete.Enabled = False
33 .cmdSearch.Enabled = True
34 End With
35 grpcatitem.Visible = False
36 'GroupBox1.Visible = True
37 FillListView(ExecuteSQLQuery("SELECT Item_ID as 'ID', TBL_Category_Item_File.Catg_ID as 'Category ID', Group_Name AS 'Brand' ,replace(Replace(Item_Name,'$.$',''''),'$..$',',') as 'Name', Item_Description as 'Description / Item Number', Item_Barcode as 'Barcode', Item_Reorder_Point as 'Reorder Point', Item_Org_Price as 'Price', Item_Price as 'Price (VAT 12%)', Unit_Measure as 'Measure' " & _
38 "FROM TBL_Category_Item_File " & _
39 "INNER JOIN TBL_Category_File ON TBL_Category_Item_File.Catg_ID = TBL_Category_File.Catg_ID " & _
40 "INNER JOIN TBL_Group ON TBL_Category_File.Group_ID = TBL_Group.Group_ID " & _
41 "ORDER BY Item_Name"), lstCat, 0)
42 End If
43 End Sub
44
45 Private Sub cmdcancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdcancel.Click
46 grpCat.Visible = False
47 RBALL.Enabled = True
48 RBCat.Enabled = True
49 rbcatitemlist.Enabled = True
50 End Sub
51
52 Private Sub CmdSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdSearch.Click
53 If RBCat.Checked Then
54
55 sqlSTR = "SELECT Catg_ID as 'Category ID', Catg_Name as 'Category Name', Catg_Description as 'Category Description' " & _
56 "FROM tbl_Category_File " & _
57 "WHERE LEFT(Catg_Name," & Len(txtcatname.Text) & ") ='" & txtcatname.Text & "'"
58 FillListView(ExecuteSQLQuery(sqlSTR), lstCat, 1)
59 ElseIf RBALL.Checked Then
60 ' sqlSTR = "SELECT Item_ID as 'ID', Catg_ID as 'Category ID', Item_Name as 'Name', Item_Description as 'Description', Item_Barcode as 'Barcode', Item_Reorder_Point as 'Reorder Point', Item_Price as 'Price' " & _
61 ' "FROM TBL_Category_Item_File " & _
62 ' "WHERE Item_Name LIKE '%" & txtcatname.Text & "%'"
63 sqlSTR = "SELECT Item_ID as 'ID', Catg_ID as 'Category ID', replace(Replace(Item_Name,'$.$',''''),'$..$',',') as 'Name', Item_Description as 'Description / Item Number', Item_Barcode as 'Barcode', Item_Reorder_Point as 'Reorder Point', Item_Price as 'Price' " & _
64 "FROM TBL_Category_Item_File " & _
65 "WHERE LEFT(Item_Name," & R_eplace(Len(txtcatname.Text)) & ") ='" & R_eplace(txtcatname.Text) & "'"
66 FillListView(ExecuteSQLQuery(sqlSTR), lstCat, 1)
67 ElseIf rbcatitemlist.Checked Then
68 ' sqlSTR = "SELECT Catg_ID as 'Category ID', Catg_Name as 'Category Name', Catg_Description as 'Category Description' " & _
69 ' "FROM tbl_Category_File " & _
70 ' "WHERE Catg_Name LIKE '%" & txtcatname.Text & "%'"
71 sqlSTR = "SELECT Catg_ID as 'Category ID', Catg_Name as 'Category Name', Catg_Description as 'Category Description' " & _
72 "FROM tbl_Category_File " & _
73 "WHERE LEFT(Catg_Name," & Len(txtcatname.Text) & ")= '" & txtcatname.Text & "'"
74 FillListView(ExecuteSQLQuery(sqlSTR), lstCategory, 1)
75 End If
76
77 grpCat.Visible = False
78 RBALL.Enabled = True
79 RBCat.Enabled = True
80 rbcatitemlist.Enabled = True
81 End Sub
82
83 Private Sub rbcatitemlist_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbcatitemlist.CheckedChanged
84 If rbcatitemlist.Checked Then
85 MDIREFRESH()
86 With MDIMain
87 .cmdDelete.Enabled = False
88 .cmdSearch.Enabled = False
89 ' .ToolStripDelete.Enabled = False
90 End With
91 grpcatitem.Visible = True
92 grpCat.BringToFront()
93 FillListView(ExecuteSQLQuery("SELECT Catg_ID as 'Category ID', Catg_Name as 'Category Name', Catg_Description as 'Category Description' FROM tbl_Category_File "), lstCategory, 0)
94 lstCategory.Focus()
95 lstCategory.Select()
96 'GroupBox1.Visible = False
97 End If
98
99 End Sub
100
101 Private Sub lstCategory_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstCategory.Click
102 FillListView(ExecuteSQLQuery("SELECT Item_ID as 'Item ID', replace(Replace(Item_Name,'$.$',''''),'$..$',',') as 'Item Name', Item_Description as 'Description / Item Number', Item_Barcode as 'Barcode', Item_Reorder_Point as 'Reorder Point', Unit_Measure as 'Measure', Item_Price as 'Price' FROM tbl_Category_Item_File WHERE Catg_ID =" & lstCategory.FocusedItem.Text & " ORDER BY Item_Name"), lstItems, 1)
103 End Sub
104
105 Private Sub FrmCatList_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
106 With Me
107 GroupBox1.Width = (.Width - (MDIMain.TSHoldRight.Width / 2)) + 60
108 GroupBox1.Height = .Height - (MDIMain.TSHoldAdvisory.Height + 45)
109 .lstCat.Width = GroupBox1.Width - 10
110 .lstCat.Height = GroupBox1.Height - 18
111 .RBALL.Left = (GroupBox1.Left + GroupBox1.Width) - (.RBALL.Width)
112 .rbcatitemlist.Left = (.RBALL.Left - .rbcatitemlist.Width) - 2
113 .RBCat.Left = (.rbcatitemlist.Left - .RBCat.Width) - 2
114 .RBGroup.Left = (.RBCat.Left - .RBGroup.Width) - 2
115 '////
116
117 grpcatitem.Width = (.Width - (MDIMain.TSHoldRight.Width / 2)) + 60
118 grpcatitem.Height = .Height - (MDIMain.TSHoldAdvisory.Height + 45)
119 .lstCategory.Width = grpcatitem.Width - 28
120 .lstItems.Width = grpcatitem.Width - 28
121 .lstItems.Height = grpcatitem.Height - (lstCategory.Height + 23)
122
123 End With
124 End Sub
125
126 Private Sub RBGroup_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RBGroup.CheckedChanged
127 If RBGroup.Checked Then
128 grpcatitem.Visible = False
129 With MDIMain
130 .cmdEdit.Enabled = True
131 .cmdPrint.Enabled = True
132 .cmdDelete.Enabled = False
133 .cmdSearch.Enabled = False
134 .cmdPrint.Enabled = False
135 .cmdRefresh.Enabled = True
136 ' .ToolStripEdit.Enabled = False
137 ' .ToolStripPrint.Enabled = False
138 End With
139 'GroupBox1.Visible = True
140 FillListView(ExecuteSQLQuery("SELECT Group_ID AS 'ID', Group_Name AS 'Name', Group_Description AS 'Description' FROM TBL_Group"), lstCat, 0)
141 End If
142 End Sub
143 End Class